﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ComObjError()</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../css/default.css" rel="stylesheet" type="text/css">
</head>
<body>

<h1>ComObjError() <span class="ver">[AHK_L 53+]</span></h1>

<p>启用或禁用 COM 错误通告.</p>

<pre class="Syntax">Enabled := ComObjError(Enable)</pre>
<h3>参数</h3>
<table class="info">
  <tr>
    <td>Enable</td>
    <td>布尔值 (真或假).此参数是可选的.</td>
  </tr>
  <tr>
    <td>Enabled</td>
    <td><span class="ver">[v1.0.91+]:</span> 保存调用函数前的实际设置.</td>
  </tr>
</table>

<h3>一般说明</h3>
<p>使用 COM 对象后, <a href="../Variables.htm#LastError">A_LastError</a> 包含了由 COM 对象的 <a href="http://msdn.microsoft.com/en-us/library/ms221479.aspx">IDispatch::Invoke</a> 函数返回的 HRESULT 码.通过调用 <code>ComObjError(false)</code> 来禁用错误通告并检查 A_LastError 的值, 脚本可以实现自身的错误处理.</p>

<h3>相关</h3>
<p><a href="ComObjCreate.htm">ComObjCreate</a>, <a href="ComObjGet.htm">ComObjGet</a>, <a href="ComObjActive.htm">ComObjActive</a>, <a href="ComObjConnect.htm">ComObjConnect</a></p>

</body>
</html>
